package com.tech.tool.repository;

import com.tech.tool.dataobject.UserInfo;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;

public interface UserInfoRepository extends JpaRepository<UserInfo, String> {

    UserInfo findByUserLogin(String loginName);

    @Query(value = "select * from user_info where user_delete=?1 and if(?2 !='', user_name like ?2, 1=1)" ,nativeQuery = true)
    Page<UserInfo> findByUserDeleteAndUserName(Integer delete, String userName, Pageable pageable);

}
